Software tool for heuristic search methods

ABSTRACT

A modeling tool for building a model of a problem involves a plurality of variables, whereby a heuristic search method can be carried out to optimize a solution for the modeled problem. The model of a problem includes a plurality of expressions defined as corresponding to one or more declarative statements and at least some of the expressions are dependent on at least one of the variables. The problem modeling tool can include automatically updating each declarative statement in response to changes to each variable associated therewith.

This application is the U.S. national phase of international applicationPCT/GB02/00051 filed 8 Jan. 2002 which designated the U.S.

FIELD OF THE INVENTION

This invention relates to a software tool for heuristic search methodsand has particular but not exclusive application to solving complexnumerical problems based on real-world applications.

BACKGROUND

Typically a problem can be defined by decision variables, an objectivefunction and functional constraints. Decision variables are used torepresent decisions that need to be made, while constraints describe thelogical or physical conditions that the decision variables must obey.When configuring a system to solve or optimize a problem, thesevariables and constraints are input to the system. For example,considering the workforce management problem, a workforce manager maywant to know which engineers to schedule to which task, and acorresponding decision variable may include a discrete variable withpossible values comprising the different engineers, while theconstraints may include the complexity of the tasks involved, skilllevel of technician, the duration of tasks and travel time etc.

Conventionally, a model of the problem is set up using a digitalprocessor, and the model, or problem model, is subject to at least someof the aforementioned constraints. Different solutions to the problemcan be obtained by changing decision variables of the model. Forexample, in the engineer-scheduling problem, the order in whichengineers are scheduled to complete their tasks can be changed and othervariables, such as the duration of the day during which they work, canbe altered. The resulting schedules can be tested against certainobjective values such as the amount of time that individual engineersare idle or are travelling, and a schedule may be chosen on the basis ofwhichever schedule solution best satisfies the objective values for thesolution.

Thus, the problem model can be used to calculate a number of candidatesolutions, which are then compared on the basis of their correspondingobjective values to determine the best solution.

It would be possible to compute each possible solution for the range ofvalues of all of the variables and then search amongst the resultingsolutions for a solution which best meets the objective values. This isknown as an exact searching method. Sophisticated exact searchingmethods normally use a tree representation for enumerating all candidatesolutions. Relational constraints are used to prune parts of the treethat lead to infeasible solutions, thus reducing the searching effort.

Exact search techniques such as linear programming may be applied to theproblem model. With linear programming methods are applied to complexproblems, which have many and disparate types of input variables, asignificant data processing overhead is involved. In more sophisticatedsystems, specialised mechanisms may be devised which, after a change hasbeen made to some of the input variables, restrict the computations toonly the affected parts of the problem model. These mechanisms need tobe coded for each particular problem requiring expert knowledge from theprogrammer. Furthermore, they are tedious to implement and maintain forrealistic problems, which are of complex nature.

As an alternative to exact search methods, a heuristic search can becarried out. In a heuristic search method, rather than compute orenumerate each possible candidate solution, an individual candidatesolution is taken, and then one or more of the values of the decisionvariables used in the computation of the candidate solution is changed.A new solution is computed on the basis of the changed variables and adetermination is made of whether the newly computed solution is betterthan the first. The process may be repeated a number of times until theresulting solution results in optimization of the objective values.

A number of different heuristic searching techniques are known in theart for optimizing the solution for the problem model. For example, in aso-called single solution or local search technique, a first solution istaken and then perturbed to determine whether a better solution can beobtained when processed by the problem model. In a so-called populationsearch technique, a number of solutions are obtained and a so-calledgenetic algorithm may be used to combine parts of the solutions into newsolutions to be tested with the problem model.

Hitherto, heuristic search methods have been used to optimize solutionsto complex, real-world problems involving large numbers of variables.For example, proposals have been made to use heuristic search methodsoptimize schedules used in workforce management, where field serviceengineers may need to perform repair tasks at different locations atdifferent time of the day, according to a schedule. The schedule needsto be optimized as a function of the travel required by the engineers tocomplete their allocated tasks, the number of tasks left unallocatedgiven the available number of engineers, and delays in task execution,the engineer skills and how well they match to task requirements andother factors such as the urgency of the individual tasks. Heuristicsearch methods have also been proposed for optimizing the scheduling oftelephone calls, e.g. incoming calls to operations in a call center, andalso for the allocation of frequency bands for use by radio transmitterse.g. in a cellular mobile telecommunications network.

However, difficulties have been encountered in formulating suitableproblem models for use with heuristic search optimization methods, andan individual problem model usually needs to be specially crafted andset up for a particular problem. Furthermore it has been found thatdifferent heuristic searching techniques have different levels ofefficiencies for different problem models so that, when a particularproblem model has been designed and a particular heuristic searchtechnique associated with it, it is extremely difficult to change theconfiguration without extensive reprogramming.

The present invention seeks to overcome these difficulties.

SUMMARY OF THE INVENTION

The exemplary embodiment of the invention provides a method ofoptimizing allocation of resources for a resource allocation problem,the problem being defined by problem variables, problem expressions,problem constraints and an objective function to be optimized inaccordance with a predetermined optimization criterion, wherein theproblem variables are representative of at least some of resources to beallocated, temporal parameters associated with allocation of theresources, tasks to be performed, costs associated with allocation ofresources, capabilities of the resources and capacity of the resources,the problem expressions are representative of relationships between theproblem variables, and the problem constraints are representative ofconstraints placed upon the problem variables. The method comprises:

-   -   i. building a model of said resource allocation problem in        accordance with said problem variables, problem expressions,        problem constraints, and objective function,    -   ii. generating a solution to the modeled problem, the initial        solution comprising a set of values representative of at least        some of the problem variables,    -   iii. applying a change to the solution by modifying one or more        values in the set,    -   iv. identifying problem expressions directly and/or indirectly        dependent on the modified values,    -   v. of the dependent problem expressions identified at step (iv),        -   a. selecting an identified problem expression from the            dependent problem expressions identified at step (iv),        -   b. evaluating whether one or more inputs to the selected            problem expression has changed,        -   c. if the or each input has not changed, marking the            selected problem expression, and all problem expressions            dependent on the said selected problem expression as            unchanged,        -   d. selecting the next problem expression identified at step            (iv), and        -   e. repeating steps (b)-(d) until there are no further            problem expressions to be selected.

The exemplary embodiment of this invention also provides a problemmodeling tool for building a model of a problem where the probleminvolves a plurality of variables and a heuristic search method can becarried out to optimize a solution for the modeled problem. The model ofa problem comprises a plurality of expressions defined as correspondingone or more declarative statements and at least some of the expressionsare dependent on at least one of said variables. The problem modelingtool includes means for automatically updating the or each declarativestatement in response to changes to the or each variable associatedtherewith.

By the use of declarative statements in accordance with an exemplaryembodiment of the invention a problem model can be built in whichconstraints and objective values can be declaratively presented in theprograms, resulting in a significant simplification of the model.Furthermore, the declarative statement may be defined using a pluralityof operators, including Boolean, arithmetic, logical, string, object andset operators.

The variables comprise dynamic parameters and static parameters. Dynamicparameters include decision variables, which comprise part of thecandidate solution to be optimised and are thus modified during theheuristic search method. Static parameters include user-specifiedparameters, which are unchanged by the heuristic search method, e.g.number of resources available.

Each declarative statement used in the problem model may be so arrangedthat a declarative statement based on a first set of variables,representing a first candidate solution, can be modified in response toa second set of variables, corresponding to a second candidate solution,causing update of a second declarative statement—e.g. based on changesto the second set of variables. Declarative statements can thereforethemselves be dependent on other declarative statements, and updated inresponse to changes in other declarative statements. In this way, theprocessing overhead associated with producing more than one candidatesolution for use in a heuristic search method, is significantly reduced.

Preferably, the problem modeling tool further includes a heuristicsearching means arranged to perform a heuristic search through candidatesolutions for the problem model, in order to search for an optimizedsolution to the modeled problem. The heuristic searching meansconveniently includes a plurality of different heuristic searching partsconfigured so that the heuristic searching algorithm can be constructedfrom a selected plurality of the heuristic searching parts. The problemmodeling tool additionally includes means adapted to evaluate thecandidate solutions in the heuristic search for optimizing a solution tothe problem.

Heuristic searching parts include computer code that can carry outoperations such as search methods, where the search methods includelocal search or population-based search methods. The parts can be joinedwith one or more other parts to form a heuristic search algorithm.

Preferably the invention further includes a heuristic searching meansarranged to perform a heuristic search through candidate solutions forthe problem model, to search for an optimised solution to the modeledproblem, wherein the heuristic searching means includes a plurality ofdifferent heuristic searching parts configured so that the heuristicsearching algorithm can be constructed from a selected plurality of theheuristic searching parts.

The invention also includes a method of constructing a model of aproblem, making use of the aforesaid modeling tool, and optimizing asolution to the problem being modeled. The method of constructing themodel comprises defining a plurality of expressions as corresponding oneor more declarative statements, where at least some of the expressionsare dependent on at least one of said variables and describe at least inpart the conditions, constraints and objectives of said problem. Themethod of optimizing a solution comprises constructing a heuristicsearching algorithm from a plurality of heuristic searching parts andapplying the constructed heuristic search algorithm to the constructedmodel.

The heuristic searching parts may be defined by object classes stored ina library of parts.

BRIEF DESCRIPTION OF THE DRAWINGS

Further aspects, features and advantages of the present invention willbe apparent from the following description of preferred embodiments ofthe invention, which are given by way of example only and with referenceto the accompanying drawings, in which:

FIG. 1 is a schematic diagram of a processor configuration for running aproblem modeling tool according to the invention;

FIG. 2 is a schematic diagram of object packages for the problemmodeling tool;

FIG. 3 is a schematic diagram of actors for use in modeling a workforcescheduling problem;

FIG. 4 is a schematic flow diagram of process steps performed incarrying out the modeling;

FIG. 5 is a schematic diagram of the problem modeling tool and itssolution;

FIG. 6 is a schematic illustration of the invariants and input variablesfor a workforce scheduling problem, arranged in invariant blocks;

FIG. 7 illustrates a mark phase associated with the configuration ofFIG. 6;

FIG. 8 illustrates an evaluation phase associated with the configurationof FIG. 7;

FIG. 9 is a schematic illustration of a tree of heuristic searchingmethods;

FIG. 10 is an extension of FIG. 2, and shows a visualisation package anda library of search parts for the problem modeling tool;

FIG. 11 is an output of the visualisation package used by the problemmodeling tool;

FIG. 12 a is a further output of the visualisation package used by theproblem modeling tool, before an on-screen modification; and

FIG. 12 b is a further output of the visualisation package used by theproblem modeling tool, after an on-screen modification.

DETAILED DESCRIPTION

In the following description, an example of a modular software modelingtool is described. The software which forms the tool can be run on anysuitable data processing apparatus such as the configuration shown inFIG. 1, which comprises a conventional workstation or personal computer1 shown in dotted outline, which, as well known in the art includes avisual display 2, keyboard 3, mouse 4, processor 5, storage in the formof a floppy disc, hard disc or CD/DVD 6, read-only memory 7 randomaccess memory 8, all connected by a common bus 9. The configuration mayalso include a network connection 10 which may provide a connection toprocessors at remote locations through a network 11.

Programs which make up the software modeling tool may be stored on thecomputer-readable medium storage device 6 and run by the processor 5under the control of the keyboard 3 and mouse 4, so as to provide anoutput on the display 2. The programs may also be run according todifferent regimes, for example in a distributed manner through thenetwork 11 or in other configurations evident to those skilled in theart. In the following example, it is assumed that the programs whichmake up the modeling tool are stored in the storage device 6.

The software tool according to an exemplary embodiment of the inventionadopts an object oriented approach and is programmed in an objectoriented language. In the following example, the Java Programminglanguage is used, although C++ or other procedural and/orobject-oriented languages could be utilized. The tool is configured inobject packages as shown in FIG. 2. The software includes a package P1that includes an object class relating to problem modeling, to enable aparticular problem to be modeled. Examples include:

a car sequencing problem 12, which models the constraints for sequencingcars on the same production line, each one with different mechanical andelectrical components options to be fitted;

radio frequency allocation problem 13, which models the allocation offrequencies to transmitters for use in a mobile telephone network;

graph coloring problem 14, to model the application of assigningdifferent colors to regions of a graphical display; and

a grouping problem 15, which models the partition of a set of persons togroups subject to various constraints and preferences of these persons.

The software modeling tool also includes a package P3 of Invariants.This comprises a library of Invariant object classes which are used formodel building as will be explained in more detail hereinafter.

The Invariants in package P3 are declarative expressions that representproblem constraints, conditions and objectives. In declarativeprogramming, or with “declarative languages,” the programmer tells thecomputer what the problem is and the computer works out how to solve it.Thus users concentrate on defining the input and output rather than theprogram steps required in a procedural language such as C++, COBOL orVisual Basic. Examples of declarative languages include query languages,report writers, interactive database programs, spreadsheets andapplication generators.

Invariant constraints are essentially conditions and objectives, thesemantics of which are specified by the user, but the processing andupdating of which are handled by the computer. Importantly, the computerhandles this updating independently of any processing of decisionvariables that are featured in the constraints. For example considerdecision variables x, y, for which the problem objective is to minimiseabs(x*y). This (abs(x*y)) is an invariant, which is to say that thepackage of invariants P3 includes a constraint satisfaction algorithmthat will ensure abs(x*y) is updated every time x or y change. Forexample, package P1, which includes the package of problem modelingcode, includes procedural computer code that applies heuristic searchmethods to the decision variables x, y in an attempt to satisfy aproblem objective. This code essentially modifies x and y by applyingchanges to the decision variables in accordance with a predeterminedprocedure defined by the code. Meanwhile, every time a change is made tox and/or y, problem objective abs(x*y) is automatically andindependently updated by package P3.

A further package P5 includes an object class for scheduling. Objects ofthe scheduling package P5 may extend objects of the problem modelingpackage P1.

The object classes of the scheduling package P5 may be suitable formodeling, for example:

shop job scheduling 16 for scheduling the processing of job orders in ashop floor over a number of machines subject to sequencing and otherconstraints;

routing schedules 17 for vehicles for e.g. package delivery vehicles,and

workforce scheduling 18, where individual work schedules are created fora number of technicians to carry out tasks such as repair tasks.

The modeling of a workforce scheduling problem will now be considered inmore detail by way of example. Examples of at least some of the problemattributes are shown in FIG. 3, and may comprise a number of resources20, typically comprising field engineers who are required to carry out anumber of activities 21, e.g. repair tasks which each have a start time22 (e.g. leaving the company depot), a task description 23, may involvea break 24, and have an end time 25 (e.g. returning to the companydepot).

The objective is to produce an activity schedule for the resources 20.For example, the objective may be to derive a schedule, which detailstimes allocated to individual telephone network repair tasks forindividual field service engineers, while minimizing time that theresources (engineers) spend between jobs. Typically repair tasks areautomatically reported by a computer and are allocated individualpriorities. These tasks, together with their times and priorities, areinput to the problem modeling package P1, which is used to set up aproblem model for solving this optimization problem.

In order to model the scheduling problem, a number of object classes areutilized from the packages P1, P3, P5 shown in FIG. 2.

Instances of the following classes may be used.

Class WSP (Workforce Scheduling Problem)

This class is held in the scheduling package P5 and extends an objectclass “Schedule” which in its turn extends the object class Problemfound in package P1. In the nomenclature of Java, the class can beexpressed as:

com.bt.examples.wsp Class WSP java.lang.Object | +--com.bt.mdl.Problem |+--com.bt.sch.ScheduleClass JOB

This extends an object class Task, which in its turn extends a classActivity found in the package P5. In the nomenclature of Java, the classcan be expressed as:

com.bt.examples.wsp Class Job java.lang.Object | +--com.bt.sch.Activity| +--com.bt.sch.TaskClass TECH

This corresponds to an individual technician and inherits from an objectclass Resource found in the scheduling package P5. In the nomenclatureof Java, the class can be expressed as:

com.bt.examples.wsp Class Tech java.lang.Object | +--com.bt.sch.Resource

As stated above, objects from the Invariant library package P3 are usedto provide declarative programming capabilities within the programminglanguage used to define the problem i.e. the scheduling model. As anexample, the object of Activity will be considered in more detail, theobject Activity has associated decision variables “previous” and “next”.Also, Activity has associated invariants “start time” (st) and “endtime” (et). These invariants define the start and end times for aparticular Activity (e.g. a job to be carried out by an engineer) foruse in solving the scheduling problem.

In accordance with the invention, by using the Invariants defined in theInvariant library package P3, a declarative relationship between thestart and end time for successive jobs in the schedule can be defined asfollows:st=previous.et+delay  (1)

Thus, the start time for a particular Activity can be defined in termsof the end time of the previous activity time (i.e. for a previous task)plus a delay which may correspond to a travel time or a set up time. Thedelay time may be a constant i.e. a fixed time period.

Similarly, the end time for the Activity may be defined as follows:et=st+duration  (2)

Also, the Activity may be subject to a constraint e.g. must be completedbefore a particular time e.g. 8 p.m. This can be expressed as follows:et<8 p.m.  (3)

These relationships effectively constitute one-way data flow constraintsand can be expressed in the Java programming language using theInvariant relationships from the Invariants package P3.

The Invariant library provides a large number of different declarativefunctions (operators—listed and described below), which can be used indefining the problem model. The advantage of using invariants is thatwhen multiple solutions are derived from the model, the computing timerequired to compute the successive solutions, after modifications, issignificantly reduced; previously, in Java, it would have been necessaryto procedurally define all of the steps corresponding to the invariants,which would involve significantly more processing time whencomputing/changing individual solutions to the modeling framework.Furthermore, in formulating complex problem models, the programmer wouldhave had to handle (write code) updating of any variables that depend onother variables, in response to changes in these other variables. Thisis not required with invariants, as they fully automate this task.Details of some of the classes from the Invariant library are set outbelow for the package P3, which is named hereinafter as “Inv”:

Package com.bt.inv

P3 provides all of the necessary classes for implementing arithmetic andsymbolic invariants in Java.

Inv The class Inv provides access to all the operators for buildinginvariants. Invariant This is the base class for all expression classes.e.g. an Invariant y is given an expression of the form y = f (x1, x2, .. . , xn) and is classified by data type InvariantManager This is themanager class for the invariant network, which holds information aboutthe invariant network and initiates the different steps of theconstraint satisfaction algorithm, coordinating different operations ofthe algorithm. This class also collects statistics for the algorithm.InvariantModelEvent This class represents an event in the model ofinvariants kept in the invariant manager. This class enables an externalobserver to monitor changes in the structure of the Invariant Model.Examples include InvariantAdded and InvariantRemoved, which allows theuser to receive notifications whenever invariants are respectively addedto, or removed from, the problem model. InvariantObservable This classallows the user to get notified of changes to the current/saved value ofan invariant.

Class Inv provides access to all the operators for building invariants.These invariants, which as stated above comprise constraints andobjectives, can represent input variables or expressions (i.e. derivedfrom input variables or other expressions) of one of the basic datatypes Integer, Real, Boolean, Object, String. In this embodiment objectsof the class do not need to be created since all of its methods arestatic.

Operator Summary: Methods in class Inv Static BooleanExp not (BooleanExpb) Static BooleanExp and (BooleanExp b1, BooleanExp b2) StaticIntegerExp abs (IntegerExp I) Static IntegerExp plus (IntegerExp I1,IntegerExp I2) Static RealExp Prod (RealSetExp s, RealExp [ ] v) staticRealExp sum (RealExp [ ] v) Static BooleanExp lt (IntegerExp I1,IntegerExp I2) Static IntegerExp elem (IntegerExp I, IntegerExp [ ] v)

This is just a selection of a few methods. In practice, there areseveral hundred to cover the mathematical operations to be performedwhen using Invariants.

The invariant package P3 also includes the following classes, whichprovide housekeeping and/or monitoring of the invariants:

ExternalData This class provides the user with the ability to defineexternal functions and predicates to be used in the computation ofinvariants. ModelChange This offers access to statistics related to themodel SessionStats change sessions of an InvariantManager object.Memento Memento base class. This class allows the state of a variable tobe stored so that the algorithm can go back to this solution at a laterstage. The alternative is to store the whole invariant network, which istime/memory consuming. State This class holds a snapshot of all or someof the variables of an invariant manager using the memento classes.

The following classes include basic data types (Integer, Real, Boolean,Object, String) referred to above, which are used to define the inputvariables or expressions that make up the invariants:

BOOLEAN BooleanExp This is the base class for all boolean expressionclasses. BooleanVar This class is used for representing booleanvariables. BooleanVarMemento Memento of the value of a boolean variable.INTEGER IntegerExp This is the base class for all integer expressionclasses. IntegerSetExp This class implements an integer set expression.IntegerSetIterator An iterator class for integer set expressions whichallows the programmer to iterate over the elements that are contained inan integer set expression. IntegerSetVar This class is used forrepresenting integer set variables. IntegerVar This class is used forrepresenting integer variables. IntegerVarMemento Memento of the valueof an integer variable. OBJECT ObjectExp This is the base class for allobject expression classes. ObjectSetExp This class implements an objectset expression. ObjectSetIterator An iterator class for object setexpressions which allows the programmer to iterate over the elementsthat are contained in an object set expression. ObjectSetVar This classis used for representing object set variables. ObjectVar This class isused for representing object variables. ObjectVarMemento Memento of thevalue of an object variable. REAL RealExp This is the base class for allreal expression classes. RealSetExp This class implements an real setexpression. RealSetIterator An iterator class for real set expressionswhich allows the programmer to iterate over the elements that arecontained in an real set expression. RealSetVar This class is used forrepresenting real set variables. RealVar This class is used forrepresenting real variables. RealVarMemento Memento of the value of areal variable. STRING StringExp This is the base class for all stringexpression classes. StringSetExp This class implements an string setexpression. StringSetIterator An iterator class for string setexpressions which allows the programmer to iterate over the elementsthat are contained in an string set expression. StringSetVar This classis used for representing string set variables.

Using the Classes and methods presented above, the equations (1)-(3)above can be expressed as follows:IntegerExp st=Inv.plus(Inv.elem(previous, et _(—)vector),delay);  Equation (1)IntegerExp et=Inv.plus(st, duration);  Equation (2)BooleanExp end _(—) time _(—) constraint=Inv.It(et, 8);  Equation (3)

The operator elem returns the i-th element of a vector, where i is anexpression or a variable. In the example above, elem is used to returnthe end time belonging to the “previous” activity from the vectorstructure holding the values of all activity end times et_vector. Alsothe It operator stands for “less than”, translating the equation (3)directly into code.

As stated above, the advantage of using invariants is that allexpressions are automatically and efficiently updated when an inputvariable, such as “previous”, changes, thus implementing a declarativeprogramming paradigm inside a procedural language such as Java.

The invariant package P3 also includes means for handling the updatingof variables and for making changes to the problem models. These meansare known as interfaces:

Interface Summary InvariantModel This is the interface that needs to beimplemented by Listener classes that want to listen for changes in theinvariant model (interfaces with InvariantModelEvent) Transaction Thisis the interface implemented by the manager class of the Invariantnetwork (InvariantManager). This class allows changes to be made to theinvariant model, allows evaluation of the effects of changes, and allowschanges to be undone etc (e.g. where changes are made to decisionvariables by parts of the heuristic search methods). In addition thisinterface enables changes to be made to values assigned to variables.The transaction class thus acts as an interface between theInvariantManager and search methods (see below), between theInvariantManager and the user, and between the InvariantManager andvisualisation objects (see below). Variable This interface providesmethods for saving/restoring the values of variables.

FIG. 4 illustrates schematically the steps involved in setting up andrunning a problem model, which in this case comprises a work schedulingproblem model: At step S1, object classes are selected from thescheduling package P5 and optionally from the problem modeling packageP1 depending on the tasks involved. At step S2, objects are created asappropriate for the model concerned e.g. TECH, JOBS, WSP.

Then, at step S3 the problem variables and problem objectives aredefined in a Solution class object for the model.

FIG. 5 is a schematic illustration of a problem model PM1 created usingthe software modeling tool. It will be understood that in this example,the problem model PM1 represents a workforce scheduling problem. At step54, solution object 26 (defined at step S3), which contains a specificset of values of decision variables for the model i.e. number ofengineers, number of tasks, task sequence for each engineer, type oftasks, task location, is run through the problem model PM1 to produceone or more objective values 27 which constitute a measure of thesuitability of the candidate Solution 26. The problem model may alsoprovide an output 28 indicative of whether the candidate solutionsatisfies the various problem constraints.

The running of the program at step S4 firstly involves running aconstraint satisfaction algorithm, where changes to decision variablesin the current solution object are automatically transferred to theinvariants.

This is handled internally by the invariant package P3. Two commonone-way constraint satisfaction schemes, which are methods for handlingthe updating of the constraints, for one-way constraints are themark/sweep strategy and the topological ordering strategy. If theconstraints are evaluated only when their values are requested, thesweep phase is known as a “lazy” evaluator. If all out-of-dateconstraints are evaluated as soon as the mark phase is complete, thesweep phase is called an “eager” evaluator. It has been found thatmark/sweep algorithms have the advantage of being more flexible insupporting both “eager” and “lazy” evaluation modes and because of theirsimplicity they can be implemented efficiently.

These methods are described in Hudson, S., Incremental AttributeEvaluation: A Flexible Algorithm for Lazy Update, ACM Transactions onProgramming Languages and Systems, Vol. 13, No. 3, pp. 315-341, July1991; and Hoover, R., Incremental Graph Evaluation. PhD thesis,Department of Computer Science, Cornell University, Ithaca, N.Y., 1987respectively. A mark/sweep algorithm has two phases: a mark and a sweepphase. In the mark phase, constraints that depend upon a changedvariable are marked out-of-date. In the sweep phase, constraints whosevalues are requested are evaluated and the constraints are marked asup-to-date.

The mark phase includes identifying all constraints (problemexpressions) that are directly or indirectly dependent on changedvariables, and essentially identifies which of the constraints maypotentially need to be updated. The sweep phase is essentially arecursive evaluation process, in which, for each of the problemexpressions identified in the mark phase, the following steps arecarried out:

-   -   1. the value of the “marked” problem expression is requested,    -   2. the inputs to this problem expression, if any, are        identified,    -   3. the identified inputs are evaluated        The sweep phase is recursive because step 3 essentially involves        returning to step 2 for the input itself, and repeating steps 2,        3 until there are no further inputs to the input.

At any stage of the recursive process, when the identified inputs areevaluated, the algorithm identifies whether any of the input values haveactually changed. If none of the inputs have changed value, there is noneed to evaluate any of the problem expressions that depend on thatinput. Thus expressions are only evaluated when at least one of itsinputs has changed value. Preferably this evaluation is incremental, sothat, for example, if the problem expression=x1+x2+x3+ . . . +xn, andthe only changed input is x2, the new value of the problem expression iscomputed fromProblem expression_(new)=Problem expression_(old) −x2_(old) +x2_(new)The invariant package P3 includes different incremental updatemechanisms for different operators.

A specific example of mark and sweep strategy will now be described withreference to FIGS. 6, 7 and 8 in relation to the workforce schedulingproblem. FIG. 6 illustrates first and second jobs that are carried outin a tour by an engineer, as part of the workforce scheduling problem.Each job is subject to the expressions and the constraint previouslydescribed with reference to equations (1)-(3). Thus, one job ischaracterised by Inv.1 and Inv.2 which correspond to equations (1) and(2) respectively, together with constraint C1 which corresponds toequation (3). The job has input variables I1, -I4, in which:

-   I1=previous.et, namely the end time of the previous job-   I2=delay following the end time of the previous job-   I3=the duration of the job-   I4=a deadline by which the job must be completed e.g. 8 pm.

The next job is similarly defined in terms of expressions andconstraints and is subject to input variables I5-I8 wherein:

-   I5=the end time (of et?) of the previous job-   I6=the delay following the previous job-   I7=duration of the job and-   I8=a deadline by which the job must be completed e.g. 10 pm

It will be understood that the end time of the previous job i.e. theoutcome of Inv.2 corresponds to the value of I5, as shown by the dottedarrow. The delay I6 may correspond to the time taken for the engineer totravel from first job to the second job.

It will also be understood that I5 may not only be an input variable butalso a decision variable in order to allow the job to be reordered, ifnecessary, to achieve a better solution to the problem.

If the jobs are similar, the same invariant block shown in FIG. 6 may bereplicated many times for each job with each invariant block feeding thenext with data.

Alternatively, more than one type of job may be included in which casedifferent invariant blocks may be coupled together using the samegeneral methodology. FIG. 7 illustrates that mark phase for a single oneof the invariant blocks shown in FIG. 6, the other block being omittedto simplify the description. In this example, it is assumed that theduration of the job has changed i.e. the value of I3 has altered. Duringthe mark phase, the invariants which will be altered by the change invalue of the duration I3, are identified as “influenced” and are markedaccordingly. In the schematic illustration of FIG. 7, the influencedinvariants are shown having a cross-hatched pattern, namely Inv.2 andC1.

FIG. 8 illustrates the evaluation phase. During the evaluation phase,the influenced invariants identified during mark phase shown in FIG. 7,are updated. Only the marked invariants are updated, thereby reducingthe processing load.

The evaluation phase can be started arbitrarily at any of the invariantsthat have been marked, or the choice may depend upon the invariantproperties. Assuming that the process starts at invariant C1, then etneeds to be updated first. To update et, the condition Inv.2 needs to beupdated using the new value of 13. (Note that if Inv.1 had beeninfluenced by the change to I3, it would also be necessary to backtrackto Inv.1; however, as Inv1.1 is not marked as being influenced, it isnot necessary to go back further). Since the duration I3 has changed, etwill also change and becomes “affected” and is marked with a tick inFIG. 8. When et gets its new value, the value of C1 is thenre-evaluated. The expression et<deadline may or may not remain true andtherefore may or may not be affected according to the specific values ofthe variables in the problem.

Thus the advantage of this mark and sweep strategy is that only theinfluenced invariants need to be re-evaluated and of these influencedinvariants, not all of them are necessarily affected. For typicalchanges to the workforce scheduling problem, less than 0.5% of theinvariants are influenced and an even smaller number are typicallyaffected, meaning that only a small number of unnecessary evaluationsoccur. Thus, the computation time is significantly reduced as comparedwith a complete re-calculation of the entire model.

Referring back to FIG. 4, a Solution object is then tested againstproblem objectives and problem constraints, and, at step S.5, if, forexample, the solution object does not satisfy one or more problemobjectives, the solution (decision variables) can be manipulated by aselected heuristic search algorithm. If a change is applied to any ofthe decision variables (i.e. to the solution object), step S.4 isre-run, so that the effect of the changed decision variable ispropagated through corresponding expressions and constraints.

The following example illustrates the effect of steps S.4 and S.5:consider a problem having decision variables x, y, an invariant x<y,which is a boolean expression and a problem constraint; and an invariantabs(x*y) which is a real expression and the problem objective. Aconstraint satisfaction algorithm, handled by the invariant package P3at step S.4, will make sure that x<y and abs(x*y) are updated when x ory change values. Thus when, for example, at step S.5 of FIG. 4, aselected heuristic search algorithm manipulates the decision variables(x and y), step S.4 is invoked, ensuring that the problem constraintsare evaluated.

As is disclosed in another of our applications EP01303274.3, eachheuristic search algorithm that is applied to a solution object is builtfrom one or more heuristic search parts. Each heuristic search part is aparticular type of heuristic search method; as is known in the art,there are a number of different heuristic search methods and an overviewis given below. In general each of these methods is represented by apart in a library of heuristic search parts L1, shown schematically inFIG. 9.

Local Search Schemes/Methods

A small change is applied to a current solution, so as to move from thecurrent solution to a nearby solution. Local search methods differ inthe criteria used to determine whether or not the “nearby” solution thenbecomes the “current solution”. Examples of local search methods includesimulated annealing, hill climbing.

A number of different techniques are known to be suitable forimplementing and processing a local search method, including

-   -   Initial solution generation, for generating an initial solution,        s,    -   Neighbourhood, a subset of all possible solutions (S),        designated N(s), which is associated with each solution s∈S,    -   Neighbourhood search, which is a search among the solutions in        the neighbourhood,    -   Aspiration criterion, an example of a criterion for selecting a        solution in the neighbourhood,    -   Move, which contains all pertinent information necessary for a        Neighborhood N(s) to move from a current solution s to a        destination solution s′.    -   Dynamic objective function, which is a Function to be optimised,        e.g. s*=min{f(s)|s∈S}, where f is an objective function with        domain S, the set of possible solutions to a given problem, and        s is one solution to the problem. and others; for more        information refer to E. H. L. Aarts, J. K. Lenstra.(1997), Local        search in combinatorial optimization, John Wiley & Sons,        Chichester.

New solutions, generated by applying local search methods, are evaluatedthrough the problem model to identify which solution best satisfies theobjective function(s). Referring to the example solution 26 shown inFIG. 5, it will be understood that the solution comprises individualvalues of the decision variables DVar1 . . . DvarN, such that theattempt to improve the solution involves applying moves to individualvalues of the decision variables.

Population Based Schemes/Methods (Genetic Algorithms)

A population of parent solutions interact with each other to produce apopulation of child (or offspring) solutions: the selection of parentsolutions for interaction is often dependent on the quality ofsolutions, and the scheme by which they interact (e.g. type ofcross-over) is dependent on the problem. In addition to inter-solutioninteractions, mutations can be applied to the children. The newpopulation of offspring solutions is then considered as a population ofparents for the next iteration of the method. This is repeated manytimes in search of (a) solution(s) having optimal quality of solution.

A number of different techniques are known to be suitable forimplementing and processing a population based techniques, including

-   -   initial population generation for generating an initial        population,    -   crossover for crossing elements of one solution with elements of        another,    -   mutation for applying a small change to an existing solution,    -   selection restart population method for re-starting a search        method and others; for further reading refer to D. E.        Goldberg.(1989), Genetic Algorithms in Search, Optimization, and        Machine Learning, Addison-Wesley, Reading, Mass.

As stated above, parts corresponding to these methods are stored in a“library” of parts L1 and can then be selected when creating a searchalgorithm so that users can “plug and play” parts together, enablingcreation and testing of wide-ranging types of algorithms in a relativelyshort time. As a result, even a non-expert can easily build a heuristicsearch algorithm by selecting individual heuristic search parts andcombining them to provide a particular form of a heuristic searchalgorithm, and the understanding, tuning and comparison of heuristicsearch algorithms can readily be carried out. An example of a heuristicsearch algorithm, built using the parts in the parts library, is shownin FIG. 6. This is a hybrid algorithm (local search plus populationbased search) that uses a local method to apply a mutation.

More details of the library of search parts L1, readily available in theform of object classes, are set out in the Appendix.

Invariants and Heuristic Search Parts

Known optimization methods include tools that apply exact search methods(such as linear programming methods) to problem models to identifyoptimum solutions. As stated in the introductory part of thedescription, relational constraints are particularly well suited toexact search methods, where the main goal is a reduction in the searchspace to be explored, since relational constraints can propagatereductions in the domain of one decision variable to the domain of otherdecision variables, thereby efficiently reducing the number of feasiblealternatives.

Heuristic search techniques require an efficient way to access theimpact of incremental solution changes to the problem's constraints(i.e. constraint checks) and also the value of the objective function.Invariants are particularly adept at this task since they canincorporate specialized incremental update mechanisms for the differentoperators applied to solutions, in addition to the general algorithmsavailable for restricting the parts of the constraint graph that need tobe updated after a change in the input variables (decision variables inthis case).

In particular, the modular aspects of the heuristic search parts areparticularly well suited to invariants. The library of search parts L1preferably includes detector parts that plug into search parts andlisten for results of applying moves and changing decision variables,and then act on the results. As described above, invariants provideautomatic updating of all of the decision variables, so that thedetector parts can react in real-time to changes applied by heuristicsearch parts. Because each heuristic search algorithm comprises aplurality of search parts plugged together, detectors can be pluggedinto any level of the algorithm, thereby providing a facility forreacting at a much finer scale than with other optimisation systems.Advantages include being able to evaluate and stop the algorithm at anypart-to-part boundary in the algorithm rather than having to progressthrough the whole algorithm before evaluating it.

Interactive Visualisation Tool

Embodiments of the invention optionally include a visualisation packageP7, shown in FIG. 10, which includes various visualisation objectclasses—e.g. object classes to invoke a Gantt chart 31, a capacity chart32 and a map chart 33—and a means 34 for connecting the visualisationobjects to a problem model. A Gantt chart is a horizontal bar chartdeveloped as a production control tool and is fully described in “AProfessional's Guide to Systems Analysis”, Martin E. Modell, 2nd. Ed.McGraw Hill, 1996. Capacity and map charts are problem specificvisualisation applications, that are used to display vehicle capacityand routes relating to vehicle scheduling. For a specific problem model,the means 34 connects these applications into parts of the Invariantclass (via the Transaction interface class described above), so that thesolution 26 can be visualised by a user. FIG. 8 shows a Gantt chartplugged into a vehicle scheduling problem, where allocation of vehicles,with respect to time, is visualised. In the vehicle scheduling problemthe decision variables comprising the solution 26 include time allocatedto task, inter-job route and travel time, and task duration.

The following illustrates how a Gantt chart object can be configured toreceive and display updates to decision variables (e.g. to allow a userto watch changes made by heuristic search algorithms):

This class represents a task entry in the Gantt Chart.

-   public class TaskEntry implements java.util.Observer {Task t; // t    is the task as defined in the problem model

Connect the TaskEntry with the underlying Task Object used to requestreceipt of notifications from the problem model relating to the task forspecific invariants, e.g. startTime and endTime, so that visualizationobject knows where to display the task in a task timeline.

void connectToProblemModel( ) { t.getStartTimeVar().getSavedValueObservable( ).addObserver(this); t.getEndTimeVar().getSavedValueObservable( ).addObserver(this); }

TaskEntry object denoted by this is added as an observer of thestartTime and endTime invariants, so that a TaskEntry object registersinterest with the startTime and endTime invariants (startTime andendTime are invariants as defined in Equations 1 and 2).

By virtue of the TaskEntry object registering interest with thestartTime and endTime invariants, the following “update” method isinvoked when the value of any of the above invariants changes:

public void update( ) { setStartUnit(t.getStartTime( ));setEndUnit(t.getEndTime( )); }

Thus suppose that the StartTime and the EndTime changed, this methodwill set its startUnit and endUnit to the new values obtained straightfrom the problem model. (setStartUnit( ) and setEndUnit( ) additionallycontain code manipulating the graphics displayed on the screen and thein particular the portion of the Gantt Chart affected. Suitable codecould readily be written by one skilled in the art).

In addition to visualising the decision variables comprising thesolution 26, the applications can receive inputs from the user, and passthese inputs to the invariants via the connecting means 34. For example,considering the Gantt chart visualisation of the vehicle schedulingproblem shown in FIG. 11, the user can drag and drop, in a known manner,tasks anywhere within the Gantt chart. As the Gantt chart object isplugged into the problem model via connecting means 34, movement oftasks by the user has the effect of changing the corresponding decisionvariables. In effect, these changes are handled in an identical mannerto the handling of a heuristic search method, so that changes todecision variables are received by the InvariantManager class andpropagated through the constraint satisfaction algorithm as describedabove.

An example of the control aspect, which defines how the user manuallyinteracts with the Gantt Chart, is given below. In this example, thecode that checks whether a task entry can be dragged and dropped fromone part of the Gantt Chart to another—i.e. Package P7 includes a methodcalled isGoodDrop( ) for checking whether a drop action is allowed ornot. The code below includes excerpts from code that assesses thevalidity of user action—e.g. dropping a task:

public boolean isGoodDrop( . . . ) { Task   t = ((TaskEntry)entry).getTask( ); schedule.beginValueChanges( );t.insert(activityBefore); schedule.endValueChanges( ); if(!schedule.isFeasible( )) { schedule.undoValueChanges( ); return false;} the drop is not a good one schedule.undoValueChanges( ); return true;}the drop is good but we shouldn't commit to it yet; this will be done inthe method below

Package P7 also includes code for handling validated dropping of a taskto another, or to the same, resource (when the drop has been validatedas described above):

public void dropEvent(DjtDropEvent dropEvent) {schedule.beginValueChanges( ); t.insert(activityBefore);schedule.endValueChanges( ); int result =schedule.propogateValueChanges( ); schedule.saveValueChanges( ); return;}

FIGS. 12 a and 12 b respectively show “before” and “after” making achange in task allocation by dragging a task from vehicle 10 anddropping it on vehicle 11. Referring to FIGS. 12 a and 12 b, theInvariantManager propagates changes to corresponding decision variables,updating the constraints and problem objectives, and automaticallyadjusts the required travel times between tasks, as can be seen from thechanges to the thick lines.

1. A method of optimizing allocation of resources for a resourceallocation problem, the problem being defined by problem variables,problem expressions, problem constraints and an objective function to beoptimized in accordance with a predetermined optimization criterion,wherein the problem variables are representative of at least some ofresources to be allocated, temporal parameters associated withallocation of the resources, tasks to be performed, costs associatedwith allocation of resources, capabilities of the resources and capacityof the resources, wherein the problem expressions are representative ofrelationships between the problem variables, and wherein the problemconstraints are representative of constraints placed upon the problemvariables, the method comprising: (i) building a model of said resourceallocation problem in accordance with said problem variables, problemexpressions, problem constraints, and objective function, whereby aheuristic search method are carried out to optimize a solution for themodeled problem; (ii) generating a solution to the modeled problem, thesolution comprising a set of values representative of at least some ofthe problem variables; (iii) generating a further solution to themodeled by: (a) modifying one or more values in the set of variablesrepresentative of at least some of the problem variables for thepreviously generated solution; (b) identifying problem expressionsdirectly and indirectly dependent on the modified values and of thedependent problem expressions identified, (c) selecting an identifiedproblem expression from the dependent problem expressions identified at(b), (d) evaluating whether one or more inputs to the selected problemexpression has changed, (e) if the or each input has not changed,marking the selected problem expression, and all problem expressionsdependent on the said selected problem expression as unchanged, and, ifthe input has changed, evaluating the selected problem expression andevaluating all problem expressions directly and indirectly dependent onsaid selected problem expression, (f) selecting the next problemexpression identified at (b), and (g) repeating (c)-(e) until there areno further problem expressions to be selected; (iv) assessing whetherthe objective function satisfies the predetermined optimizationcriterion as a result of the change applied at (iii), and, if not,repeating (iii) until the objective function is deemed to satisfy thepredetermined optimization criterion; (v) determining whether thegenerated further solution better satisfies the objective function andif so, setting the generated further solution as the solution to bemodified in (a); (vi) repeating (iii) through (v) until a predeterminednumber of solutions have been generated; and (vii) outputting thegenerated solution which best satisfies the objective function as asolution to the modeled problem.
 2. A method according to claim 1,wherein evaluating whether an input to the selected problem expressionhas changed comprises recursively identifying and evaluating inputs tothe input.
 3. A method according to claim 1, wherein evaluation of theselected problem expression comprises: calculating a difference betweenthe value of the changed input before and after the change, and addingthe difference to the or each problem expressions dependent thereon. 4.A problem modeling tool embodied in a computer-readable storage mediumfor optimizing allocation of resources for a resource allocationproblem, the problem being defined by problem variables, problemexpressions, problem constraints and an objective function to beoptimized in accordance with a predetermined optimization criterion,wherein the problem variables are representative of at least some ofresources to be allocated, temporal parameters associated withallocation of the resources, tasks to be performed, costs associatedwith allocation of resources, capabilities of the resources and capacityof the resources, wherein the problem expressions are representative ofrelationships between the problem variables, wherein the problemconstraints are representative of constraints placed upon the problemvariables, and the problem modeling tool comprising: (i) a modeler forbuilding a model of said resource allocation problem in accordance withsaid problem variables, problem expressions, problem constraints, andobjective function, whereby a heuristic search method are carried out tooptimize a solution for the modeled problem; (ii) a solver forgenerating a solution to the modeled problem, the solution comprising aset of values representative of at least some of the problem variables;(iii) the solver being further operable to: (a) modify one or morevalues in the set of variables representative of at least some of theproblem variables for a previously generated solution; (b) identifyproblem expressions directly and/or indirectly dependent on the modifiedvalues and of the dependent problem expressions identified, (c) selectan identified problem expression from the dependent problem expressionsidentified at (b), (d) evaluate whether one or more inputs to theselected problem expression has changed, (e) in a case where the or eachinput has not changed, mark the selected problem expression, and allproblem expressions dependent on the said selected problem expression asunchanged, and if the input has changed, said solver evaluating theselected problem expression and evaluating all problem expressionsdirectly and indirectly dependent on said selected problem expression,(f) select the next problem expression identified at (b), and (g) repeat(c)-(e) until there are no further problem expressions to be selected,in order to generate further solutions to the modeled problem; (iv) saidsolver further assesses whether the objective function satisfies thepredetermined optimization criterion as a result of the change appliedat (iii), and, if not, repeating at (iii) until the objective functionis deemed to satisfy the predetermined optimization criterion; (v) atester for determining whether each generated further solution bettersatisfies the objective function and if so, said tester being furtheroperable to set the generated further solution as the solution to bemodified in (a); (vi) repeating (iii) through (v) until a predeterminednumber of solutions have been generated; and (vii) a displayer foroutputting the generated solution which best satisfies the objectivefunction as a solution to the modeled problem.
 5. A problem modelingtool embodied in a computer-readable storage medium according to claim4, wherein evaluating whether an input to the selected problemexpression has changed comprises recursively identifying and evaluatinginputs to the input.
 6. A problem modeling tool according to claim 4,wherein evaluation of the selected problem expression comprises:calculating a difference between the value of the changed input beforeand after the change, and adding the difference to the or each problemexpressions dependent thereon.